<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我的订单 - 学平险投保</title>
    <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <link href="../css/styles.css" rel="stylesheet">
    <style>
        /* 基础样式保护 */
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            line-height: 1.5;
            color: #333333;
            background-color: #f5f5f5;
            margin: 0;
            padding: 0;
        }
        
        .page-container {
            padding: 16px;
            padding-bottom: 70px;
            max-width: 600px;
            margin: 0 auto;
        }
        
        .card {
            background: white;
            border-radius: 12px;
            padding: 16px;
            margin-bottom: 16px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        }
        
        .form-group {
            margin-bottom: 16px;
        }
        
        .form-label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
        }
        
        .form-label.required::after {
            content: '*';
            color: #f5222d;
            margin-left: 4px;
        }
        
        .form-input {
            width: 100%;
            padding: 12px;
            border: 1px solid #e8e8e8;
            border-radius: 8px;
            font-size: 16px;
            transition: all 0.3s;
        }
        
        .form-input:focus {
            border-color: #1890ff;
            box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
            outline: none;
        }
        
        .btn {
            display: inline-block;
            padding: 12px 24px;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 500;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s;
            border: none;
            text-decoration: none;
        }
        
        .btn-primary {
            background-color: #1890ff;
            color: white;
        }
        
        .btn-primary:hover {
            background-color: #40a9ff;
        }
        
        .btn-block {
            display: block;
            width: 100%;
        }
        
        .nav-bar {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background: white;
            box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
            z-index: 100;
        }
        
        .nav-bar .grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 8px;
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 8px 0;
            color: #666;
            text-decoration: none;
            font-size: 12px;
        }
        
        .nav-item.active {
            color: #1890ff;
        }
        
        .nav-item i {
            font-size: 20px;
            margin-bottom: 4px;
        }
        
        .modal {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(0, 0, 0, 0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1000;
        }
        
        .modal-content {
            background: white;
            border-radius: 16px;
            padding: 24px;
            max-width: 90%;
            max-height: 80vh;
            overflow-y: auto;
        }
        
        .hidden {
            display: none;
        }
    </style>
    <style>
        /* 验证码按钮样式优化 */
        .verify-code-btn {
            min-width: 120px;
            white-space: nowrap;
            background: none;
            border: 1px solid var(--primary-color);
            color: var(--primary-color);
            padding: 0 16px;
            height: 40px;
            line-height: 38px;
            border-radius: 8px;
            font-size: 14px;
            transition: all 0.3s;
            cursor: pointer;
        }

        .verify-code-btn:hover {
            background-color: rgba(24, 144, 255, 0.1);
        }

        .verify-code-btn:disabled {
            border-color: #d9d9d9;
            color: #999;
            cursor: not-allowed;
            background: none;
        }

        /* 输入框组样式优化 */
        .input-group {
            display: flex;
            gap: 12px;
            align-items: center;
        }

        .input-group .form-input {
            flex: 1;
        }

        /* 验证码按钮倒计时动画 */
        @keyframes countdown {
            from {
                transform: scale(1);
                opacity: 1;
            }
            50% {
                transform: scale(0.98);
                opacity: 0.8;
            }
            to {
                transform: scale(1);
                opacity: 1;
            }
        }

        .verify-code-btn.counting {
            animation: countdown 1s infinite;
            background-color: rgba(24, 144, 255, 0.1);
        }

        /* 验证码按钮禁用状态优化 */
        .verify-code-btn:disabled {
            border-color: #d9d9d9;
            color: #999;
            cursor: not-allowed;
            opacity: 0.8;
        }

        .verify-code-btn:disabled.counting {
            border-color: var(--primary-color);
            color: var(--primary-color);
            opacity: 0.8;
        }
    </style>
</head>
<body>
    <div class="page-container">
        <!-- 登录表单 -->
        <div id="loginForm" class="card">
            <h2 class="text-xl font-bold mb-6">登录查看订单</h2>
            <form onsubmit="return login(event)">
                <div class="form-group">
                    <label class="form-label required">手机号码</label>
                    <input type="tel" class="form-input" placeholder="请输入投保人手机号" pattern="\d{11}" required>
                </div>
                <div class="form-group">
                    <label class="form-label required">验证码</label>
                    <div class="input-group">
                        <input type="text" class="form-input" placeholder="请输入验证码" maxlength="6" required>
                        <button type="button" class="verify-code-btn" onclick="sendVerifyCode(this)">获取验证码</button>
                    </div>
                </div>
                <button type="submit" class="btn btn-primary btn-block mt-6">登录</button>
            </form>
        </div>

        <!-- 订单列表 -->
        <div id="orderList" class="hidden">
            <h2 class="text-xl font-bold mb-4">我的订单</h2>
            
            <!-- 示例订单 -->
            <div class="card">
                <div class="flex justify-between items-start mb-4">
                    <div>
                        <h3 class="font-medium">学生综合保障计划</h3>
                        <p class="text-sm text-gray-500">订单号：2024030100001</p>
                    </div>
                    <span class="text-success">待生效</span>
                </div>
                
                <div class="space-y-2 text-sm">
                    <div class="flex justify-between">
                        <span class="text-gray-500">投保人</span>
                        <span>张天龙</span>
                    </div>
                    <div class="flex justify-between">
                        <span class="text-gray-500">被保险人</span>
                        <span>张俊豪</span>
                    </div>
                    <div class="flex justify-between">
                        <span class="text-gray-500">保障期间</span>
                        <span>2025-09-01 至 2026-09-01</span>
                    </div>
                    <div class="flex justify-between">
                        <span class="text-gray-500">保费</span>
                        <span class="text-primary font-medium">¥80</span>
                    </div>
                </div>

                <div class="mt-4 flex justify-end gap-2">
                    <button class="btn" onclick="showOrderDetail()">查看详情</button>
                    <button class="btn btn-primary" onclick="window.location.href='claim-guide.html'">我要理赔</button>
                </div>
            </div>

            <!-- 更多订单... -->
        </div>

        <!-- 订单详情弹窗 -->
        <div id="orderDetailModal" class="modal" style="display: none;">
            <div class="modal-content">
                <h3 class="modal-title">订单详情</h3>
                <div class="space-y-4">
                    <div class="border-b pb-4">
                        <h4 class="text-gray-500 mb-2">保险信息</h4>
                        <div class="grid grid-cols-2 gap-4 text-sm">
                            <div>
                                <label class="text-gray-500">订单号</label>
                                <p class="font-medium">2024030100001</p>
                            </div>
                            <div>
                                <label class="text-gray-500">订单状态</label>
                                <p class="text-success font-medium">待生效</p>
                            </div>
                            <div>
                                <label class="text-gray-500">起保日期</label>
                                <p class="font-medium">2025-09-01</p>
                            </div>
                            <div>
                                <label class="text-gray-500">终保日期</label>
                                <p class="font-medium">2026-09-01</p>
                            </div>
                            <div>
                                <label class="text-gray-500">保费</label>
                                <p class="font-medium text-primary">¥80</p>
                            </div>
                        </div>
                    </div>

                    <div class="border-b pb-4">
                        <h4 class="text-gray-500 mb-2">投保人信息</h4>
                        <div class="grid grid-cols-2 gap-4 text-sm">
                            <div>
                                <label class="text-gray-500">姓名</label>
                                <p class="font-medium">张天龙</p>
                            </div>
                            <div>
                                <label class="text-gray-500">身份证号</label>
                                <p class="font-medium">220186198704123215</p>
                            </div>
                            <div>
                                <label class="text-gray-500">手机号</label>
                                <p class="font-medium">13301380808</p>
                            </div>
                        </div>
                    </div>

                    <div class="border-b pb-4">
                        <h4 class="text-gray-500 mb-2">被保险人信息</h4>
                        <div class="grid grid-cols-2 gap-4 text-sm">
                            <div>
                                <label class="text-gray-500">姓名</label>
                                <p class="font-medium">张俊豪</p>
                            </div>
                            <div>
                                <label class="text-gray-500">身份证号</label>
                                <p class="font-medium">11010320706193525</p>
                            </div>
                            <div>
                                <label class="text-gray-500">与投保人关系</label>
                                <p class="font-medium">父母/子女</p>
                            </div>
                        </div>
                    </div>

                    <div>
                        <h4 class="text-gray-500 mb-2">学校信息</h4>
                        <div class="grid grid-cols-2 gap-4 text-sm">
                            <div>
                                <label class="text-gray-500">所在地区</label>
                                <p class="font-medium">吉林省-延边州</p>
                            </div>
                            <div>
                                <label class="text-gray-500">学校名称</label>
                                <p class="font-medium">测试1幼儿园</p>
                            </div>
                            <div>
                                <label class="text-gray-500">年级</label>
                                <p class="font-medium">幼儿园</p>
                            </div>
                            <div>
                                <label class="text-gray-500">班级</label>
                                <p class="font-medium">3班</p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="mt-6 text-center">
                    <button class="btn" onclick="closeModal('orderDetailModal')">关闭</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 底部导航 -->
    <nav class="nav-bar">
        <div class="grid grid-cols-4 gap-2">
            <a href="home.html" class="nav-item">
                <i class="fas fa-home"></i>
                <span>首页</span>
            </a>
            <a href="consultation.html" class="nav-item">
                <i class="fas fa-comments"></i>
                <span>问题咨询</span>
            </a>
            <a href="claim-guide.html" class="nav-item">
                <i class="fas fa-file-alt"></i>
                <span>我要理赔</span>
            </a>
            <a href="my-orders.html" class="nav-item active">
                <i class="fas fa-user"></i>
                <span>我的订单</span>
            </a>
        </div>
    </nav>

    <script>
        // 发送验证码
        function sendVerifyCode(btn) {
            // 获取手机号输入框
            const phoneInput = document.querySelector('input[type="tel"]');
            const phone = phoneInput.value.trim();
            
            // 验证手机号
            if (!phone) {
                alert('请输入手机号码');
                phoneInput.focus();
                return;
            }
            if (!/^1[3-9]\d{9}$/.test(phone)) {
                alert('请输入正确的手机号码');
                phoneInput.focus();
                return;
            }

            // 禁用按钮并开始倒计时
            let countdown = 60;
            btn.disabled = true;
            const originalText = btn.textContent;
            
            // 创建倒计时函数
            const timer = setInterval(() => {
                countdown--;
                btn.textContent = `${countdown}秒后重试`;
                
                // 添加动画类
                btn.classList.add('counting');
                
                if (countdown <= 0) {
                    // 倒计时结束，恢复按钮状态
                    clearInterval(timer);
                    btn.disabled = false;
                    btn.textContent = originalText;
                    btn.classList.remove('counting');
                }
            }, 1000);

            // 模拟发送验证码
            console.log('发送验证码到手机号：', phone);
        }

        // 登录
        function login(event) {
            event.preventDefault();
            document.getElementById('loginForm').style.display = 'none';
            document.getElementById('orderList').classList.remove('hidden');
            return false;
        }

        // 显示订单详情
        function showOrderDetail() {
            document.getElementById('orderDetailModal').style.display = 'flex';
        }

        // 关闭弹窗
        function closeModal(id) {
            document.getElementById(id).style.display = 'none';
        }
    </script>
</body>
</html> 